// app.js
// import { request } from "./utils/request.js"
const net=require("./utils/request.js")
App({
  onLaunch() {
    // 展示本地存储能力
    // const logs = wx.getStorageSync('logs') || []
    // logs.unshift(Date.now())
    // wx.setStorageSync('logs', logs)
  },
  getAccessToken(){
    net.request('https://api.weixin.qq.com/cgi-bin/token',{
      grant_type: 'client_credential',
      appid:'wx3d38ce1103a82225',
      secret:'3c41ca428b4d0f43cfaef6f567a1cc06'
    },"GET",res=>{
      console.log(res);
    })
  },
  globalData: {
    userInfo: null,
    invite_code:''
  },
  onShareAppMessage(){
    // console.log(111);
    // const userId = wx.getStorageSync('userId')
    // return {
    //   title: '东方蝴蝶专业减肥',
    //   path: '/pages/home/home?from_userId='+userId,
    // }
  }
})
!function(){
  var PageTmp = Page;
  Page =function (pageConfig) {
    const userId = wx.getStorageSync('userId')
    // 设置全局默认分享
    pageConfig = Object.assign({
            //右上角分享功能
            onShareAppMessage () {
                console.log(userId);
                return {
                    title: '东方蝴蝶专业减肥',//分享标题
                    path: '/pages/home/home?from_userId='+userId,//分享用户点开后页面
                    // imageUrl: 'https://download4.qcplay.com/box/shareImg.png',//分享图片
                }
            }
    },pageConfig);
    PageTmp(pageConfig);
  };
}();
